<template>
	<view class="">
		<view class="topbg">
			<view class="title">
				<text class="name_color"></text>
				<text class="guanzhu">诚挚邀请你关注</text>
			</view>
			<view class="gongsi">{{companyname}}</view>
			<image class="ewmimg" :src="erweima" mode=""></image>
		</view>

		<view class="m-2 bg-white rounded-20 icon_share py-2">
			<view class="border-bottom d-flex j-center a-center py-4">
				<view class="text-center" @click="save">
					<image src="../../static/images/goods/icon_share_clipboard.png" mode=""></image>
					<view class="">保存到相册</view>
				</view>
			</view>
		</view>
	</view>

</template>

<script>
	export default {
		data() {
			return {
				yaoqing_picture: "",
				shopname: "",
				companyname: "",
				erweima: "",
				ru_id: 0
			}
		},
		onLoad() {
			this.getdata();
		},
		//分享到朋友圈
		onShareTimeline() {
			return {
				title: this.shopname,
				path: "/pagesB/yaoqingzhuce/yaoqingzhuce",
				imageUrl: "https://aaa.slwjpfw.com/1.jpg",
			};
		},
		//发送给朋友
		onShareAppMessage() {
			return {
				title: this.shopname,
				path: "/pagesB/yaoqingzhuce/yaoqingzhuce",
				imageUrl: "https://aaa.slwjpfw.com/1.jpg",
			};
		},
		methods: {
			getdata() {
				this.$H.post("v2/store/user/fenxiang").then(res => {
					if (res.status.succeed == 1) {
						this.shopname = res.data.shop_name
						this.companyname = res.data.shop_title
						this.ru_id = res.data.ru_id
						this.erweima = "https://www.sltspfw.com/api/v4/app/erweima?home=0&ru_id=" + res.data.ru_id
					}
					if (res.status.error_code == 100) {
						uni.reLaunch({
							url: '/pages/login/login'
						})
					}
				})
			},
			save() {
				const that = this
				uni.downloadFile({
					url: "https://www.sltspfw.com/api/v4/app/erweima?home=0&type=download&ru_id=" + that.ru_id,
					success: res => {
						if (res.statusCode === 200) {
							uni.saveImageToPhotosAlbum({
								filePath: res.tempFilePath,
								success: function() {
									uni.showToast({
										title: '保存成功',
										duration: 2000
									})

								},
								fail: function() {
									uni.showToast({
										title: '保存失败',
										duration: 2000
									})

								}
							})
						} else {
							uni.showToast({
								title: '保存失败',
								duration: 2000
							})
						}
					}
				})
			}
		}
	}
</script>





<style>
	.yaoqingzhuce {
		width: 100%;
	}

	.topbg {
		background: url("https://aaa.slwjpfw.com/1.jpg") center top no-repeat;
		background-size: 100% auto;
		padding-bottom: 200rpx;
	}

	.icon_share view {
		color: #888;
	}

	.icon_share image {
		width: 120upx;
		height: 120upx;
	}

	.topbg .title {
		padding-top: 150rpx;
		text-align: center;
		padding-bottom: 20rpx;
	}

	.name_color {
		/* font-size: 24rpx; */
		color: #ffaa00;
		text-align: center;
	}

	.guanzhu {
		/* 		font-size: 24rpx; */
		color: #333;
		text-align: center;
	}

	.gongsi {
		/* font-size: 28rpx; */
		color: #ffaa00;
		text-align: center;
	}

	.ewmimg {
		width: 400rpx;
		height: 400rpx;
		display: block;
		margin-left: auto;
		margin-right: auto;
		margin-top: 30rpx;
	}
</style>